﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SuperSerialization.Tree
{
    /// <summary>
    /// A node representing a field value assignment.
    /// </summary>
    class FieldNode : Node
    {
        /// <summary>
        /// The full type name of the field.
        /// </summary>
        public string Type;

        /// <summary>
        /// The name of the field.
        /// </summary>
        public string Name;

        /// <summary>
        /// The value of the field.
        /// </summary>
        public Node Value;

        /// <summary>
        /// Constructs a new empty field node.
        /// </summary>
        public FieldNode() { }

        /// <summary>
        /// Constructs a new field node.
        /// </summary>
        /// <param name="name">The name of the field.</param>
        /// <param name="value">A node representing the value of this field.</param>
        public FieldNode(string name, Node value)
        {
            this.Name = name;
            this.Value = value;
        }

        public override void Accept(TreeVisitor.AbstractVisitor visitor)
        {
            visitor.VisitField(this);
        }
    }
}
